//
//  DYCardSettingCell.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/25.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYCardSettingCell.h"

@interface DYCardSettingCell ()

@property (nonatomic,strong)UIView *blackView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *cardLabel;
@property (nonatomic,strong)UIButton *cardButton;

@end


@implementation DYCardSettingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    self.hideSeparatorLabel=YES;
    [self xhq_noneSelectionStyle];
    
    self.bgImageView=({
        UIImageView *imageView=[[UIImageView alloc]init];
        [imageView xhq_cornerRadius:5];
        imageView.userInteractionEnabled=YES;
        imageView;
    });
    
    self.blackView =({
        UIView *view=[[UIView alloc]init];
        view.backgroundColor=[UIColor colorWithWhite:0 alpha:0.2];
        [view xhq_cornerRadius:5];
        view;
    });
    
    self.titleLabel=({
        UILabel *label=[Utils labelWithTitleFontSize:17 textColor:WhiteColor alignment:0];
        label;
    });
    
    self.cardLabel =({
        UILabel *label=[Utils labelWithTitleFontSize:15 textColor:WhiteColor alignment:0];
        label;
    });
    
    
    self.cardButton=({
        UIButton *button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:WhiteColor action:@selector(cardButtonClick) target:self title:@"自助发卡" image:nil font:14 textColor:[UIColor xhq_base]];
        [button xhq_cornerRadius:BILIHEIGHT(16)];
        button;
    });
    
    [self addSubview:self.bgImageView];
    [self addSubview:self.blackView];
    [self.bgImageView addSubview:self.titleLabel];
    [self.bgImageView addSubview:self.cardLabel];
    [self.bgImageView addSubview:self.cardButton];
    
    [self.bgImageView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.right.equalTo(BILIWIDTH(-10));
        make.top.equalTo(BILIHEIGHT(BILIHEIGHT(10)));
        make.bottom.equalTo(0);
    }];
    
    [self.blackView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.right.equalTo(BILIWIDTH(-10));
        make.top.equalTo(BILIHEIGHT(BILIHEIGHT(10)));
        make.bottom.equalTo(0);
    }];
    
    [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(18));
        make.top.equalTo(BILIHEIGHT(28));
    }];
    
    [self.cardLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel);
        make.top.equalTo(self.titleLabel.bottom).offset(12);
    }];
    
    
    [self.cardButton makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-20);
        make.bottom.equalTo(BILIHEIGHT(-14));
        make.size.equalTo(CGSizeMake(BILIWIDTH(80), BILIHEIGHT(32)));
    }];
    
    self.bgImageView.image=IMG(@"img_zhuce");
    self.blackView.hidden=YES;
}
-(void)cardButtonClick
{
    !self.cardSettingBlock?:self.cardSettingBlock(self.cardButton.titleLabel.text);
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
